package com.freshcity
{
	import com.freshcity.lib.tooltip.ToolTipsManager;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class BaseSprite extends Sprite
	{
		private var _toolTip:*;
		
		public function BaseSprite()
		{
			addEventListener(Event.REMOVED_FROM_STAGE, onRemoved, false, 0, true);
		}
		
		protected function onRemoved(e:Event):void
		{
			if(this.toolTipData) this.toolTipData = null;
		}		
		
		public function get toolTipData():*
		{
			return _toolTip;
		}
		
		public function set toolTipData(value:*):void
		{
			_toolTip = value;
			if (value == null || value == "") 
			{
				ToolTipsManager.unregister(this);
			}
			else 
			{
				ToolTipsManager.register(this);
			}
		}		
	}
}